//
//  OosAbstractFeedParser.m
//  oos4ios
//
//  Created by Pablo Gonzalez on 5/12/11.
//  Copyright 2011 11870.com. All rights reserved.
//

#import "OosAbstractFeedParser.h"
#import <oos4ios/Exceptions/MethodNotImplementedException.h>

@implementation OosAbstractFeedParser

- (NSArray *) parseFeed: (OosFeed *) feed
{
    if ([feed isKindOfClass: [NSString class]]) {
        return [self parseJsonFeed: (NSString *)feed];
    } else {
        [MethodNotImplementedException raiseForSelector:_cmd 
                                               inObject:self];
        return nil;
    }
}

- (void) parseFeed: (OosFeed *) feed 
      withCallback: (id<IOosParserCallback>) callback
{
    [self reportResult: [self parseFeed:feed] 
          withCallback: callback];
}

- (NSArray *) parseJsonFeed:(NSString *)jsonFeed
{
    [MethodNotImplementedException raiseForSelector: _cmd 
                                          inObject: self];
    return nil;
}

- (void)parseJsonFeed:(NSString *)feed withCallback:(id<IOosParserCallback>)callback
{
    [self reportResult: [self parseJsonFeed:feed] 
          withCallback: callback];
}

@end
